Feature/inactivity analysis#207
Conversation
|
Thank you for submitting a pull request. Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully. Formatting and Branching
|
jagdish-15
left a comment
There was a problem hiding this comment.
This should not run only once per day as discussed here.
Also, please include users with no submission history in the skip list as well. Since they haven't solved any questions yet, they're effectively in the same category as users who have been inactive for 3+ months, and we should avoid making unnecessary API requests for them too.
| if (!user.totalSolved || user.totalSolved === 0) { | ||
| inactiveUsers.push(username); | ||
| continue; | ||
| } |
There was a problem hiding this comment.
| if (!user.totalSolved || user.totalSolved === 0) { | |
| inactiveUsers.push(username); | |
| continue; | |
| } |
This has to go for a couple of reasons.
First, this would currently flag every user as inactive because totalSolved is not a top-level field in overall.json user objects. The value is stored under data.totalSolved.
More importantly, the goal of the inactive-user logic isn't just to mark users as inactive. It's also to allow them to become active again once they start solving problems.
With this implementation, users with 0 solved problems are immediately skipped and added to the inactive list. Once they're in that list, the sync script stops fetching their latest state, which means it will never detect that they've solved a problem later.
As a result, a user who starts with 0 solves would effectively remain inactive forever, because there's no mechanism left that can observe them becoming active again.
| const overallFilePath = path.join(DATA_DIR, "overall.json"); | ||
| let users = []; | ||
| try { | ||
| const rawData = fs.readFileSync(overallFilePath, "utf8"); | ||
| users = JSON.parse(rawData); | ||
| console.log(`Loaded ${users.length} users from overall.json`); | ||
| } catch (err) { | ||
| console.error("Failed to load overall.json: ", err.message); |
There was a problem hiding this comment.
Also, loading the list of users from users.json would be more appropriate than loading it from overall.json
|
Hey @jagdish-15 Updated the inactivity script. It now syncs directly from the original users.json file and handles live API profile validation cleanly. This eliminates the data path bug and ensures 0-solve or inactive users have a daily mechanism to wake up automatically. Tested it locally against our real dataset and it works flawlessly. Let me know if it looks good to merge! |
Removed inactive user check based on solved questions.
|
/format |
|
I have successfully run Prettier and pushed the formatting fixes to this PR. Note for Contributors: Because this commit was pushed by a bot, GitHub will not automatically re-run the CI checks. To trigger them to pass, you must either:
|
|
"Ah, my bad! I was so focused on making sure we caught the 0-solve users to fix that permanent bypass trap that I blindly added the explicit check without realizing the existing calendar timestamp logic already cleanly handles them under the hood. Great catch! I've removed that redundant block so it's much cleaner now. Committed and pushed." |
|
No worries! The test run was successful |

Description
Explained in detail in issue
Linked Issue
Fixes #175
Changes Made
Type of Change
Testing
Checklist
npx prettier --write .before submittingfeature/*branch, not themainbranchScreenshots / Screen Recording